package com.napenalki.toto.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

@Entity
@Table(name = "PREDICTION")
public class Prediction {

    private int id;
    private User user;
    private Event event;
    private String prediction;
    
    public Prediction() {
    }
    
    public Prediction(User user, Event event, String prediction) {
        this.user = user;
        this.event = event;
        this.prediction = prediction;
    }

    public Prediction(int id, User user, Event event, String prediction) {
        this.id = id;
        this.user = user;
        this.event = event;
        this.prediction = prediction;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "USER_NAME", referencedColumnName = "USER_NAME")
    @Valid
    @NotNull
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "EVENT_ID", referencedColumnName = "ID")
    @Valid
    @NotNull
    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    @Column(name = "PREDICTION")
    @NotNull
    public String getPrediction() {
        return prediction;
    }

    public void setPrediction(String prediction) {
        this.prediction = prediction;
    }
    
}
